package com.jrh.dal;

import java.util.List;
import java.util.Map;

import com.jrh.domain.common.Page;
import com.jrh.domain.entity.ProductSet;

/**
 * 产品系列DAO
 * 
 * @author yout 2012-7-24 下午7:55:02
 */
public class ProductSetDao extends BaseDao<ProductSet> {

    {
        namespace = "jrh.single.productSet";
    }

    @SuppressWarnings("unchecked")
    public Page<ProductSet> listByCondition(long brandId, Integer start, Integer pageSize) {

        Map<String, Object> map = this.getPageMap(start, pageSize);
        map.put("brandId", brandId);
        List<ProductSet> list = (List<ProductSet>) sqlMapClientTemplate.queryForList(namespace + "."
                                                                                     + "listByCondition", map);
        Integer count = (Integer) sqlMapClientTemplate.queryForObject(namespace + "." + "listByCondition_count", map);
        return new Page<ProductSet>(list, start, pageSize, count);
    }

    @SuppressWarnings("unchecked")
    public List<ProductSet> listByCondition(long brandId) {

        List<ProductSet> list = (List<ProductSet>) sqlMapClientTemplate.queryForList(namespace + "." + "listByBrandId",
                                                                                     brandId);

        return list;
    }

}
